class Solution(object):
    def minStartValue(self, nums):
        s = 1
        t = 1
        for num in nums:
            t += num
            if t < 1:
                s += 1 - t
                t = 1
        return s
